﻿namespace HutongGames.PlayMaker
{
    using System;
    using UnityEngine;

    [Serializable]
    public class FunctionCall
    {
        public FsmBool BoolParameter;
        public FsmFloat FloatParameter;
        public string FunctionName;
        public FsmGameObject GameObjectParameter;
        public FsmInt IntParameter;
        public FsmMaterial MaterialParameter;
        public FsmObject ObjectParameter;
        [SerializeField]
        private string parameterType;
        public FsmQuaternion QuaternionParameter;
        public FsmRect RectParamater;
        public FsmString StringParameter;
        public FsmTexture TextureParameter;
        public FsmVector3 Vector3Parameter;

        public FunctionCall()
        {
            this.FunctionName = "";
            this.ResetParameters();
        }

        public FunctionCall(FunctionCall source)
        {
            this.FunctionName = "";
            this.FunctionName = source.FunctionName;
            this.parameterType = source.parameterType;
            this.BoolParameter = new FsmBool(source.BoolParameter);
            this.FloatParameter = new FsmFloat(source.FloatParameter);
            this.IntParameter = new FsmInt(source.IntParameter);
            this.GameObjectParameter = new FsmGameObject(source.GameObjectParameter);
            this.ObjectParameter = source.ObjectParameter;
            this.StringParameter = new FsmString(source.StringParameter);
            this.Vector3Parameter = new FsmVector3(source.Vector3Parameter);
            this.RectParamater = new FsmRect(source.RectParamater);
            this.QuaternionParameter = new FsmQuaternion(source.QuaternionParameter);
            this.MaterialParameter = new FsmMaterial(source.MaterialParameter);
            this.TextureParameter = new FsmTexture(source.TextureParameter);
        }

        public void ResetParameters()
        {
            this.BoolParameter = false;
            this.FloatParameter = 0f;
            this.IntParameter = 0;
            this.StringParameter = "";
            this.GameObjectParameter = new FsmGameObject("");
            this.ObjectParameter = null;
            this.Vector3Parameter = new FsmVector3();
            this.RectParamater = new FsmRect();
            this.QuaternionParameter = new FsmQuaternion();
            this.MaterialParameter = new FsmMaterial();
            this.TextureParameter = new FsmTexture();
        }

        public string ParameterType
        {
            get
            {
                return this.parameterType;
            }
            set
            {
                this.parameterType = value;
            }
        }
    }
}

